home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr48 / ifp1s157.zip / PAGE_13.PAS < prev    next >
Pascal/Delphi Source File  |  1993-06-26  |  7KB  |  265 lines

  1. unit page_13;
  2.  
  3. interface
  4.  
  5. uses crt, dos, ifpglobl, ifpcomon;
  6.  
  7. procedure page13;
  8.  
  9. implementation
  10.  
  11. procedure page13;
  12. type
  13.   iotbltype = record
  14.                 spclfunc: byte;
  15.                 devtype: byte;
  16.                 devattr: word;
  17.                 cylcount: word;
  18.                 medtype: byte;
  19.                 bpsec: word;
  20.                 secpclus: byte;
  21.                 resvsec: word;
  22.                 fats: byte;
  23.                 rootentries: word;
  24.                 numsecs: word;
  25.                 meddescr: byte;
  26.                 secpfat: word;
  27.                 secptrk: word;
  28.                 numheads: word;
  29.                 numhidden: longint;
  30.                 largesec: longint;
  31.                 reserved: array[$19..$1E] of byte;
  32.               end;
  33.  
  34. var
  35.   i : $00..$2B;
  36.   xbyte : byte;
  37.   xchar : char;
  38.   xFCB : array[$00..$2B] of byte;
  39.   xlong : longint;
  40.   xstring : string;
  41.   xword1 : word;
  42.   xword2 : word;
  43.   xword3, xword4, xword5: word;
  44.   iotable: iotbltype;
  45.   saveX, saveY: byte;
  46.  
  47.   begin
  48.   Caption2('LASTDRIVE');
  49.   if osmajor >= 20 then
  50.     DrvName(lastdrv)
  51.   else
  52.     DrvName(lastdrv - 1);
  53.   Writeln;
  54.   Caption2('Logical drives');
  55.   with regs do
  56.     begin
  57.     xbyte:=0;
  58.     for xchar:='A' to 'Z' do
  59.       begin
  60.       AH:=$0E;
  61.       DL:=ord(xchar) - ord('A');
  62.       MSDOS(regs);
  63.       AH:=$19;
  64.       MSDOS(regs);
  65.       if AL = DL then
  66.         begin
  67.         DrvName(AL);
  68.         Inc(xbyte);
  69.         if xbyte = 20 then
  70.           begin
  71.           Writeln;
  72.           Write('                ');
  73.           xbyte:=0;
  74.           end;
  75.         end;
  76.       end;
  77.     Writeln;
  78.     AH:=$0E;
  79.     DL:=currdrv;
  80.     MSDOS(regs)
  81.     end;
  82.   Caption2('Diskette drives');
  83.   if equip and $0001 = $0001 then
  84.     Writeln(1 + equip and $00C0 shr 6)
  85.   else
  86.     Writeln(0);
  87.   xword1:=longint(intvec[$1E]) shr 16;
  88.   xword2:=longint(intvec[$1E]) and $0000FFFF;
  89.   Caption3('Sectors/track');
  90.   Writeln(Mem[xword1 : xword2 + 4]);
  91.   Caption3('Bytes/sector');
  92.   Writeln(Mem[xword1 : xword2 + 3] shl 8);
  93.   Caption3('On time (ms)');
  94.   Writeln(125 * Mem[xword1 : xword2 + 10]);
  95.   Caption3('Off time (s)');
  96.   Writeln(longint(Mem[xword1 : xword2 + 2]) shl 16 / tick1:0:1);
  97.   Caption3('Head settle time (ms)');
  98.   Writeln(Mem[xword1 : xword2 + 9]);
  99.   if 1 + ((equip and $00C0) shr 6) = 1 then
  100.     begin
  101.     Caption1('  Single drive is now ');
  102.     xbyte:=Mem[BIOSdseg : $0104];
  103.     if xbyte <= ord('Z') - ord('A') then
  104.       begin
  105.       drvname(xbyte);
  106.       Writeln
  107.       end
  108.     else
  109.       if xbyte = $FF then
  110.         Writeln('N/A')
  111.       else
  112.         unknown('status', xbyte, 2);
  113.     end;
  114. (*  Byte 12:12 p.178  *)
  115.   Caption2('Current drive and path');
  116.   GetDir(0, xstring);
  117.   Writeln(xstring);
  118.   with regs do
  119.     begin
  120.     AH:=$52;
  121.     MsDos(regs);
  122.     if (osmajor = 3) and (osminor = 0) then
  123.       begin
  124.       xword1:=MemW[ES:BX + $19];
  125.       xword2:=MemW[ES:BX + $17]
  126.       end
  127.     else
  128.       begin
  129.       xword1:=MemW[ES:BX + $18];
  130.       xword2:=MemW[ES:BX + $16]
  131.       end;
  132.     if (osmajor >= 4) and (osmajor < 10) then
  133.       xword5:=$58
  134.     else
  135.       xword5:=$51;
  136.     if not ((xword1 = $FFFF) and (xword2 = $FFFF)) then
  137.       begin
  138.       xword3:=xword2 + (xword5 * currdrv);
  139.       Caption3('Drive type is');
  140.       case MemW[xword1:xword3 + $43] shr 14 of
  141.         0: Writeln('invalid');
  142.         1: Writeln('physical');
  143.         2: Writeln('network');
  144.         3: Writeln('Installable File System')
  145.       end;
  146.       if (osmajor >= 4) or ((osmajor = 3) and (osminor >= 20)) then
  147.         with regs do
  148.           begin
  149.           AH:=$44;
  150.           AL:=$0D;
  151.           BL:=0;
  152.           CH:=8;
  153.           CL:=$60;
  154.           DS:=Seg(iotable);
  155.           DX:=Ofs(iotable);
  156.           MsDos(regs);
  157.           if Flags and FCarry = 0 then
  158.             with iotable do
  159.               begin
  160.               Caption3('removable');
  161.               if devattr and 1 = 0 then
  162.                 Write('yes')
  163.               else
  164.                 Write('no');
  165.               Caption3('door lock');
  166.               yesorno(devattr and 2 = 2);
  167.               end
  168.           end;
  169.       Caption3('JOIN''d ');
  170.       if MemW[xword1:xword3 + $43] and $2000 = $2000 then
  171.         begin
  172.         Write('yes');
  173.         Caption3('actually');
  174.         xword4:=xword3;
  175.         while Mem[xword1:xword4] <> 0 do
  176.           begin
  177.           Write(Chr(Mem[xword1:xword4]));
  178.           Inc(xword4)
  179.           end;
  180.         Writeln;
  181.         end
  182.       else
  183.         Writeln('no');
  184.       Caption3('SUBST''d');
  185.       if MemW[xword1:xword3 + $43] and $1000 = $1000 then
  186.         begin
  187.         Write('yes');
  188.         Caption3('actually');
  189.         xword4:=xword3;
  190.         while Mem[xword1:xword4] <> 0 do
  191.           begin
  192.           Write(Chr(Mem[xword1:xword4]));
  193.           Inc(xword4)
  194.           end;
  195.         Writeln;
  196.         end
  197.       else
  198.         Writeln('no')
  199.       end;
  200.     end;
  201.   Caption3('Volume label');
  202.   for i:=$00 to $2B do
  203.     xFCB[i]:=$00;
  204.   xFCB[$00]:=$FF;         (* extended FCB *)
  205.   xFCB[$06]:=$08;         (* volume ID attribute *)
  206.   for i:=$08 to $12 do
  207.     xFCB[i]:=ord('?');
  208.   with regs do
  209.     begin
  210.     AH:=$11;
  211.     DS:=seg(xFCB);
  212.     DX:=ofs(xFCB);
  213.     MSDOS(regs);
  214.     case AL of
  215.       $00 : begin
  216.             AH:=$2F;
  217.             MSDOS(regs);
  218.             i:=$08;
  219.             xchar:=char(Mem[ES : BX + i]);
  220.             while (i <= $12) and (xchar > #0) do
  221.               begin
  222.               Write(showchar(xchar));
  223.               inc(i);
  224.               xchar:=char(Mem[ES : BX + i])
  225.               end;
  226.             Writeln
  227.             end;
  228.       $FF : Writeln('(none)')
  229.     else
  230.       unknown('status', AL, 2)
  231.     end {case}
  232.     end;
  233.   with regs do
  234.     begin
  235.     saveX:=WhereX;
  236.     saveY:=WhereY;
  237.     TextColor(LightRed+Blink);
  238.     Write('  *retrieving information*');
  239.     AH:=$1B;
  240.     MSDOS(regs);
  241.     GotoXY(saveX, saveY);
  242.     Write('                          ');
  243.     GotoXY(saveX, saveY);
  244.     media(Mem[DS : BX], AL);
  245.     Caption3('Clusters');
  246.     Writeln(DX);
  247.     Caption3('Sectors/cluster');
  248.     Writeln(AL);
  249.     Caption3('Bytes/sector');
  250.     Writeln(CX)
  251.     end;
  252.   Caption3('Total space (bytes)');
  253.   xlong:=disksize(0);
  254.   if xlong <> -1 then
  255.     Writeln(xlong:9, ' (', (xlong / 1024.0):9:0, 'K)')
  256.   else
  257.     Writeln('(invalid drive)');
  258.   Caption3('Free space (bytes) ');
  259.   xlong:=diskfree(0);
  260.   if xlong <> -1 then
  261.     Write(xlong:9, ' (', (xlong / 1024.0):9:0, 'K)')
  262.   else
  263.     Write('(invalid drive)')
  264. end;
  265. end.